package com.lb.shopguide.ui.view;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Typeface;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.lb.shopguide.config.UserConfigManager;

/**
 * Created by xhb on 2016/2/29.
 * 自定义TextView
 */
public class LbFontTextView extends AppCompatTextView {
    public LbFontTextView(Context context) {
        super(context);
        init(context);
    }

    public LbFontTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    public LbFontTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    /**
     * 设置字体
     *
     * @param context
     */
    private void init(Context context) {
        Typeface typeface = UserConfigManager.getInstance(context).getTypeface();
        if (typeface != null) {
            setTypeface(typeface);
        }
    }


}
